<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <script src="./jquery-3.5.1.js"></script>
    <title>Document</title>
    <style>
        li {
            list-style: none;
        }
    </style>
</head>
<body>
    <input type="text">
    <button class="search">搜索</button>
    <button class="add">增加</button>
    <ul>
        
    </ul>
    <script>
        
        // 查找数据
        $('.search').click(function() {
            $('ul').empty('')
            $.post(
            'http://127.0.0.1/search',
            {text: $('input').val()},
            function(res) {
                console.log(res);
                res.data.forEach(item => {
                    console.log(item.text);
                    let li = `
                    <li>${item.text}</li>`
                    $('ul').append(li)
                })
            }
        )
        })
    </script>
</body>
</html>